import request from "./request";

/** 资源 */

//发布
export async function issueRes (param,params) {
  return await request({
    url: '/resource/insert',
    method: 'post',
    data:param,
    headers: {
      'Content-Type': 'application/json',
      'token': params.token 
    }
  })
}

//分页查询
export async function pageRes (param,params) {
  return await request({
    url: '/resource/page/'+param.current+'/'+param.size+'?resourceDesc='+param.resourceDesc+'&tag='+param.tag+'&sort='+param.sort,
    method: 'get',
    headers: {
      'Content-Type': 'application/json',
      'token': params.token 
    }
  })
}

//查询历史
export async function pageResHistory (param,params) {
  return await request({
    url: '/resource/history/'+params.userId+'/'+param.current+'/'+param.size,
    method: 'get',
    headers: {
      'Content-Type': 'application/json',
      'token': params.token 
    }
  })
}

//查询详情
export async function getDetails (param,params) {
  return await request({
    url: '/resource/visit/'+param.id+'/'+params.userId,
    method: 'get',
    headers: {
      'Content-Type': 'application/json',
      'token': params.token 
    }
  })
}

//删除
export async function deleteRes (param,params) {
  return await request({
    url: '/resource/delete/'+param.id,
    method: 'delete',
    headers: {
      'Content-Type': 'application/json',
      'token': params.token 
    }
  })
}
